import React from 'react';
import ListItemSetter from '@ali-dayu/form-editor/lib/swap-setter/setters/ListItemSetter';

const formEditorStyle = (/* label, */children) => (
  <div style={{marginBottom: 24}}>
    {/* <div style={{marginBottom: 4}}>
      { label || ''}
    </div> */}
    { children }
  </div>
);

const OptionSetter = (props) => {
  // const { form, value, onChange } = props;
  const { form } = props;
  const external = form.getFieldValue('external');
  const checkboxHasValue = external && external.params && JSON.stringify(external.params) !== '{}';
  if (checkboxHasValue) {
    return null;
  }

  return formEditorStyle(/* props.label, */<ListItemSetter {...props} />);
}

export const optionSetterName = "CustomOptionFieldSetter";
export default OptionSetter;